package com.miyake.loveviewweb.server.meta;

//@javax.annotation.Generated(value = { "slim3-gen", "@VERSION@" }, date = "2012-07-11 19:58:25")
/** */
public final class ChartModelMeta extends org.slim3.datastore.ModelMeta<com.miyake.loveviewweb.shared.model.ChartModel> {

    /** */
    public final org.slim3.datastore.UnindexedAttributeMeta<com.miyake.loveviewweb.shared.model.ChartModel, java.util.Map<java.lang.String,com.google.appengine.api.datastore.Key>> axes = new org.slim3.datastore.UnindexedAttributeMeta<com.miyake.loveviewweb.shared.model.ChartModel, java.util.Map<java.lang.String,com.google.appengine.api.datastore.Key>>(this, "axes", "axes", java.util.Map.class);

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<com.miyake.loveviewweb.shared.model.ChartModel, com.miyake.loveviewweb.shared.model.ChartModel.ChartDataType> chartDataType = new org.slim3.datastore.CoreAttributeMeta<com.miyake.loveviewweb.shared.model.ChartModel, com.miyake.loveviewweb.shared.model.ChartModel.ChartDataType>(this, "chartDataType", "chartDataType", com.miyake.loveviewweb.shared.model.ChartModel.ChartDataType.class);

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<com.miyake.loveviewweb.shared.model.ChartModel, com.miyake.loveviewweb.shared.model.ChartModel.ChartEngine> chartEngine = new org.slim3.datastore.CoreAttributeMeta<com.miyake.loveviewweb.shared.model.ChartModel, com.miyake.loveviewweb.shared.model.ChartModel.ChartEngine>(this, "chartEngine", "chartEngine", com.miyake.loveviewweb.shared.model.ChartModel.ChartEngine.class);

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<com.miyake.loveviewweb.shared.model.ChartModel, java.lang.Integer> chartHeight = new org.slim3.datastore.CoreAttributeMeta<com.miyake.loveviewweb.shared.model.ChartModel, java.lang.Integer>(this, "chartHeight", "chartHeight", java.lang.Integer.class);

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<com.miyake.loveviewweb.shared.model.ChartModel, com.google.appengine.api.datastore.Key> chartPluginKey = new org.slim3.datastore.CoreAttributeMeta<com.miyake.loveviewweb.shared.model.ChartModel, com.google.appengine.api.datastore.Key>(this, "chartPluginKey", "chartPluginKey", com.google.appengine.api.datastore.Key.class);

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<com.miyake.loveviewweb.shared.model.ChartModel, java.lang.Integer> chartWidth = new org.slim3.datastore.CoreAttributeMeta<com.miyake.loveviewweb.shared.model.ChartModel, java.lang.Integer>(this, "chartWidth", "chartWidth", java.lang.Integer.class);

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<com.miyake.loveviewweb.shared.model.ChartModel, com.google.appengine.api.datastore.Key> key = new org.slim3.datastore.CoreAttributeMeta<com.miyake.loveviewweb.shared.model.ChartModel, com.google.appengine.api.datastore.Key>(this, "__key__", "key", com.google.appengine.api.datastore.Key.class);

    /** */
    public final org.slim3.datastore.StringAttributeMeta<com.miyake.loveviewweb.shared.model.ChartModel> name = new org.slim3.datastore.StringAttributeMeta<com.miyake.loveviewweb.shared.model.ChartModel>(this, "name", "name");

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<com.miyake.loveviewweb.shared.model.ChartModel, com.google.appengine.api.datastore.Key> parentKey = new org.slim3.datastore.CoreAttributeMeta<com.miyake.loveviewweb.shared.model.ChartModel, com.google.appengine.api.datastore.Key>(this, "parentKey", "parentKey", com.google.appengine.api.datastore.Key.class);

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<com.miyake.loveviewweb.shared.model.ChartModel, java.lang.Long> version = new org.slim3.datastore.CoreAttributeMeta<com.miyake.loveviewweb.shared.model.ChartModel, java.lang.Long>(this, "version", "version", java.lang.Long.class);

    private static final ChartModelMeta slim3_singleton = new ChartModelMeta();

    /**
     * @return the singleton
     */
    public static ChartModelMeta get() {
       return slim3_singleton;
    }

    /** */
    public ChartModelMeta() {
        super("ChartModel", com.miyake.loveviewweb.shared.model.ChartModel.class);
    }

    @Override
    public com.miyake.loveviewweb.shared.model.ChartModel entityToModel(com.google.appengine.api.datastore.Entity entity) {
        com.miyake.loveviewweb.shared.model.ChartModel model = new com.miyake.loveviewweb.shared.model.ChartModel();
        java.util.Map<java.lang.String,com.google.appengine.api.datastore.Key> _axes = blobToSerializable((com.google.appengine.api.datastore.Blob) entity.getProperty("axes"));
        model.setAxes(_axes);
        model.setChartDataType(stringToEnum(com.miyake.loveviewweb.shared.model.ChartModel.ChartDataType.class, (java.lang.String) entity.getProperty("chartDataType")));
        model.setChartEngine(stringToEnum(com.miyake.loveviewweb.shared.model.ChartModel.ChartEngine.class, (java.lang.String) entity.getProperty("chartEngine")));
        model.setChartHeight(longToInteger((java.lang.Long) entity.getProperty("chartHeight")));
        model.setChartPluginKey((com.google.appengine.api.datastore.Key) entity.getProperty("chartPluginKey"));
        model.setChartWidth(longToInteger((java.lang.Long) entity.getProperty("chartWidth")));
        model.setKey(entity.getKey());
        model.setName((java.lang.String) entity.getProperty("name"));
        model.setParentKey((com.google.appengine.api.datastore.Key) entity.getProperty("parentKey"));
        model.setVersion((java.lang.Long) entity.getProperty("version"));
        return model;
    }

    @Override
    public com.google.appengine.api.datastore.Entity modelToEntity(java.lang.Object model) {
        com.miyake.loveviewweb.shared.model.ChartModel m = (com.miyake.loveviewweb.shared.model.ChartModel) model;
        com.google.appengine.api.datastore.Entity entity = null;
        if (m.getKey() != null) {
            entity = new com.google.appengine.api.datastore.Entity(m.getKey());
        } else {
            entity = new com.google.appengine.api.datastore.Entity(kind);
        }
        entity.setUnindexedProperty("axes", serializableToBlob(m.getAxes()));
        entity.setProperty("chartDataType", enumToString(m.getChartDataType()));
        entity.setProperty("chartEngine", enumToString(m.getChartEngine()));
        entity.setProperty("chartHeight", m.getChartHeight());
        entity.setProperty("chartPluginKey", m.getChartPluginKey());
        entity.setProperty("chartWidth", m.getChartWidth());
        entity.setProperty("name", m.getName());
        entity.setProperty("parentKey", m.getParentKey());
        entity.setProperty("version", m.getVersion());
        entity.setProperty("slim3.schemaVersion", 1);
        return entity;
    }

    @Override
    protected com.google.appengine.api.datastore.Key getKey(Object model) {
        com.miyake.loveviewweb.shared.model.ChartModel m = (com.miyake.loveviewweb.shared.model.ChartModel) model;
        return m.getKey();
    }

    @Override
    protected void setKey(Object model, com.google.appengine.api.datastore.Key key) {
        validateKey(key);
        com.miyake.loveviewweb.shared.model.ChartModel m = (com.miyake.loveviewweb.shared.model.ChartModel) model;
        m.setKey(key);
    }

    @Override
    protected long getVersion(Object model) {
        com.miyake.loveviewweb.shared.model.ChartModel m = (com.miyake.loveviewweb.shared.model.ChartModel) model;
        return m.getVersion() != null ? m.getVersion().longValue() : 0L;
    }

    @Override
    protected void assignKeyToModelRefIfNecessary(com.google.appengine.api.datastore.AsyncDatastoreService ds, java.lang.Object model) {
    }

    @Override
    protected void incrementVersion(Object model) {
        com.miyake.loveviewweb.shared.model.ChartModel m = (com.miyake.loveviewweb.shared.model.ChartModel) model;
        long version = m.getVersion() != null ? m.getVersion().longValue() : 0L;
        m.setVersion(Long.valueOf(version + 1L));
    }

    @Override
    protected void prePut(Object model) {
    }

    @Override
    protected void postGet(Object model) {
    }

    @Override
    public String getSchemaVersionName() {
        return "slim3.schemaVersion";
    }

    @Override
    public String getClassHierarchyListName() {
        return "slim3.classHierarchyList";
    }

    @Override
    protected boolean isCipherProperty(String propertyName) {
        return false;
    }

    @Override
    protected void modelToJson(org.slim3.datastore.json.JsonWriter writer, java.lang.Object model, int maxDepth, int currentDepth) {
        com.miyake.loveviewweb.shared.model.ChartModel m = (com.miyake.loveviewweb.shared.model.ChartModel) model;
        writer.beginObject();
        org.slim3.datastore.json.Default encoder0 = new org.slim3.datastore.json.Default();
        if(m.getAxes() != null){
            writer.setNextPropertyName("axes");
            encoder0.encode(writer, m.getAxes());
        }
        if(m.getChartDataType() != null){
            writer.setNextPropertyName("chartDataType");
            encoder0.encode(writer, m.getChartDataType());
        }
        if(m.getChartEngine() != null){
            writer.setNextPropertyName("chartEngine");
            encoder0.encode(writer, m.getChartEngine());
        }
        if(m.getChartHeight() != null){
            writer.setNextPropertyName("chartHeight");
            encoder0.encode(writer, m.getChartHeight());
        }
        if(m.getChartPluginKey() != null){
            writer.setNextPropertyName("chartPluginKey");
            encoder0.encode(writer, m.getChartPluginKey());
        }
        if(m.getChartURL() != null){
            writer.setNextPropertyName("chartURL");
            encoder0.encode(writer, m.getChartURL());
        }
        if(m.getChartWidth() != null){
            writer.setNextPropertyName("chartWidth");
            encoder0.encode(writer, m.getChartWidth());
        }
        writer.setNextPropertyName("content");
        encoder0.encode(writer, m.isContent());
        if(m.getKey() != null){
            writer.setNextPropertyName("key");
            encoder0.encode(writer, m.getKey());
        }
        if(m.getName() != null){
            writer.setNextPropertyName("name");
            encoder0.encode(writer, m.getName());
        }
        if(m.getParentKey() != null){
            writer.setNextPropertyName("parentKey");
            encoder0.encode(writer, m.getParentKey());
        }
        if(m.getVersion() != null){
            writer.setNextPropertyName("version");
            encoder0.encode(writer, m.getVersion());
        }
        if(m.getXarray() != null){
            writer.setNextPropertyName("xarray");
            // double[](double[]) is not supported.
        }
        if(m.getYarray() != null){
            writer.setNextPropertyName("yarray");
            // double[](double[]) is not supported.
        }
        writer.endObject();
    }

    @Override
    protected com.miyake.loveviewweb.shared.model.ChartModel jsonToModel(org.slim3.datastore.json.JsonRootReader rootReader, int maxDepth, int currentDepth) {
        com.miyake.loveviewweb.shared.model.ChartModel m = new com.miyake.loveviewweb.shared.model.ChartModel();
        org.slim3.datastore.json.JsonReader reader = null;
        org.slim3.datastore.json.Default decoder0 = new org.slim3.datastore.json.Default();
        reader = rootReader.newObjectReader("axes");
        m.setAxes(decoder0.decode(reader, m.getAxes(), java.util.Map.class));
        reader = rootReader.newObjectReader("chartDataType");
        m.setChartDataType(decoder0.decode(reader, m.getChartDataType(), com.miyake.loveviewweb.shared.model.ChartModel.ChartDataType.class));
        reader = rootReader.newObjectReader("chartEngine");
        m.setChartEngine(decoder0.decode(reader, m.getChartEngine(), com.miyake.loveviewweb.shared.model.ChartModel.ChartEngine.class));
        reader = rootReader.newObjectReader("chartHeight");
        m.setChartHeight(decoder0.decode(reader, m.getChartHeight()));
        reader = rootReader.newObjectReader("chartPluginKey");
        m.setChartPluginKey(decoder0.decode(reader, m.getChartPluginKey()));
        reader = rootReader.newObjectReader("chartURL");
        m.setChartURL(decoder0.decode(reader, m.getChartURL()));
        reader = rootReader.newObjectReader("chartWidth");
        m.setChartWidth(decoder0.decode(reader, m.getChartWidth()));
        reader = rootReader.newObjectReader("content");
        m.setContent(decoder0.decode(reader, m.isContent()));
        reader = rootReader.newObjectReader("key");
        m.setKey(decoder0.decode(reader, m.getKey()));
        reader = rootReader.newObjectReader("name");
        m.setName(decoder0.decode(reader, m.getName()));
        reader = rootReader.newObjectReader("parentKey");
        m.setParentKey(decoder0.decode(reader, m.getParentKey()));
        reader = rootReader.newObjectReader("version");
        m.setVersion(decoder0.decode(reader, m.getVersion()));
        reader = rootReader.newObjectReader("xLabel");
        reader = rootReader.newObjectReader("xarray");
        // double[](double[]) is not supported.
        reader = rootReader.newObjectReader("yLabel");
        reader = rootReader.newObjectReader("yarray");
        // double[](double[]) is not supported.
        return m;
    }
}